home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / WCLASS95.ZIP / EIFFREAD.TXT < prev    next >
Encoding:
Text File  |  1995-08-02  |  4.9 KB  |  53 lines

  1. Steps to Generate Eiffel Code Using With Class CASE Tool
  2. by Richard Felsinger, RCF Associates, 960 Scottland Dr,
  3. Mt Pleasant, SC 29464 803-881-3648 (voice and fax) 
  4. 71162.755@compuserve.com
  5.  
  6. The With Class CASE tool provides the capability to create object-oriented diagrams, specifications, and reports.  With Class has a script language to create code generation scripts for various languages such as Eiffel.  The following are the steps to create diagrams, specifications, and Eiffel code.
  7.  
  8. Step 1: Customize With Class for Eiffel - Familiarize yourself with the With Class CASE tool. When With Class is not running update the wc2.ini for the basic Eiffel types and defaults as follows:
  9. [TYPES] Type1=INTEGER, Type2=REAL, Type3=DOUBLE, Type4=BOOLEAN, Type5=CHARACTER, Type6=STRING, Type7=ARRAY,
  10. [DEFAULTS] Type=INTEGER, ReturnType=    .  Replace the C++ types with Eiffel types.  This is to customize With Class for Eiffel.
  11.  
  12. Step 2: Create the Class Diagram - In With Class, create a class diagram using the Rumbaugh OMT or other O-O diagram notation.  Create several classes, enter the class name, attribute names, operation (routine) names for each class.  Connect the classes with a relation for inheritance, aggregation, and association.  For the aggregation and association relationships, enter a traversal path name.
  13.  
  14. Step 3: Create the Specifications - In With Class, create the class, attribute, and operation specifications with Eiffel specific information.  In the class specification enter the following:
  15. -CLASS_USER1 - enter deferred if the class is an abstract class, e.g. deferred or enter Indexing statements,
  16. -CLASS_USER2 - enter the generic type if the class is a generic class, e.g. [T],
  17. -CLASS_USER3 - enter the inherit clause for a single superclass, e.g. deferred  rename  select.
  18. -CLASS_INVARIANT - enter the complete invariant statements, e.g. invariant okGasQuantity: gasQuantity >= 0
  19. You must enter compilabe Eiffel statements into -CLASS_USER1, -CLASS_USER2, -CLASS_USER3, -CLASS_INVARIANT.
  20. -CLASS_LIBRARY_BASE_CLASS - enter the library superclass, e.g. STORABLE
  21. If the class only has a library superclass enter following: inherit STORABLE 
  22.  
  23. In the attribute specification, enter the attribute type as an Eiffel type: BOOLEAN, CHARACTER, INTEGER, REAL, DOUBLE,
  24. ARRAY, STRING.
  25.  
  26. In the operation specification, enter the following:
  27. - enter operation parameters in the form operation_type operation_name, e.g. INTEGER aNumber.  Then use the keyword -PASCAL_OPERATION_PARAMETERS to print the parameters in Eiffel form.
  28. - enter a valid Eiffel type or class in -OPERATION_RETURN_TYPE (remove default void)
  29. - enter one of the following in -OPERATION_TRANSFORMATION: do, deferred, or external.
  30. - enter a precondition in -OPERATION_PRECONDITION including require, e.g.  require okSpeed: aSpeed < 99
  31. - enter a postcondition in -OPERATION_POSTCONDITION including ensure, e.g. ensure okNewSpeed: equal (speed, aSpeed)
  32. - enter a rescue in -OPERATION_EXCEPTION_NAME including rescue, e.g.  rescue speed := 0
  33.  
  34. Step 4: Generate Eiffel Code - In With Class generate Eiffel code based upon the class diagram and specifications.  Select the Eiffel code generation script, e.g. EIFFEL1.SCT.
  35.  
  36. Step 5: In your Eiffel environment, create the ACE file and the system class.  You must manually update the generated code as follows:
  37. - for deferred classes manually delete the generated creation clause and creation routines
  38. - if a class has multiple superclasses, manually update the inherit clause to ensure redefined routines are with the correct superclass
  39. - for objects of generic classes, manually enter the actual generic parameter in the variable declaration, e.g.   myCollection: GENERIC_COLLECTION[INTEGER]
  40. - manually update the feature export, e.g. feature {TRIANGLE}
  41. - manually enter unique constants, e.g. red, yellow, blue : INTEGER is unique 
  42.  
  43. The following are several guidelines to use With Class to generate Eiffel code.
  44.  
  45. 1.  Creating Classes - Ensure that you enter compilable Eiffel in the text specification boxes.  Enter the Eiffel keywords for variant, require, ensure, rescue, etc.
  46.  
  47. 2.  Creating Abstract Classes - Put "Abstract Class" as text next to each abstract class on the class diagram.  Enter deferred in the class specification user 1 box.  Enter deferred in the operation transformation box.  In the subclass enter the deferred statement, e.g. deferred registerOperation.  After you generate code, you must delete the generated creation statements and routines.
  48.  
  49. 3.  Creating Generic Classes - On the class diagram enter the generic class name without the generic formal parameter.  Put the generic formal parameter as text next to the class on the class diagram.  In the class specification enter the generic formal parameter in the user 2 box, e.g. [T].  
  50.  
  51. The Eiffel scripts provided in With Class provides a starting point to create enhanced Eiffel code generation scripts.
  52.  
  53.